package com.ai.entity.made.page;

import com.ai.entity.BasePage;
import com.ai.entity.made.OpcNodeInfo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;

/**
 * @Author jiaok
 * @Date 2024-11-15 15:49
 */
@Data
@Getter
@Setter
public class OpcNodeInfoPage extends BasePage<OpcNodeInfo> {

    @ApiModelProperty(value = "节点对应opc服务器id")
    private String opcServerInfoId;

    @ApiModelProperty(value = "节点名称")
    private String communicationNodeName;

    @ApiModelProperty(value = "节点命名空间")
    private Integer namespace;

    @ApiModelProperty(value = "节点标识符")
    private String identifier;

    @ApiModelProperty(value = "节点状态 ")
    private String state;


    @Override
    public QueryWrapper<OpcNodeInfo> getQuery(QueryWrapper<OpcNodeInfo> queryWrapper) {
        return super.getQuery(queryWrapper)
                .eq(StringUtils.isNotBlank(opcServerInfoId),"opc_server_info_id",opcServerInfoId)
                .like(StringUtils.isNotBlank(communicationNodeName),"opc_server_name",communicationNodeName)
                .like(StringUtils.isNotBlank(identifier),"opc_server_name",identifier)
                .eq(StringUtils.isNotBlank(state),"state",state)
                .orderByDesc("create_time");
    }
}
